home *** CD-ROM | disk | FTP | other *** search
- /*
- ** Apple Macintosh Developer Technical Support
- **
- ** StandardFileIcons: A sample control panel changing behavior of StandardFile.
- **
- ** by Gordon Sheridan and Jim Luther
- ** modified by Brian Bechtel
- **
- ** File: RamDisk.h
- **
- ** Copyright © 1992-1994 Apple Computer, Inc.
- ** All rights reserved.
- **
- ** You may incorporate this sample code into your applications without
- ** restriction, though the sample code has been provided "AS IS" and the
- ** responsibility for its operation is 100% yours. However, what you are
- ** not permitted to do is to redistribute the source as "DTS Sample Code"
- ** after having made changes. If you're going to re-distribute the source,
- ** we require that you make it clear in the source that the code was
- ** descended from Apple Sample Code, but that you've made changes.
- **
- ** Change History (most recent first):
- **
- ** <3> 10/14/93 JML Added Panic debug macros and changed preprocessor constants
- ** to enums.
- ** <2> 6/13/93 gs Move dCtlFlag bits from RamDRVR.c and cleanup header.
- ** <1> 8/24/92 gs first checked in
- **/
-
- #ifndef __RAMDISK__
- #define __RAMDISK__
-
- #ifndef rez
-
- #include <Types.h>
- #include <Errors.h>
- #include <LowMem.h>
- #include <Traps.h>
- #include <GestaltEqu.h>
- #include <Memory.h>
- #include <Quickdraw.h>
- #include <DiskInit.h>
- #include <SegLoad.h>
- #include <OSUtils.h>
- #include <Script.h>
- #include <ToolUtils.h>
- #include <Events.h>
- #include <Controls.h>
- #include <TextEdit.h>
- #include <Desk.h>
- #include <Windows.h>
- #include <Dialogs.h>
- #include <Devices.h>
- #include <Disks.h>
- #include <Files.h>
- #include <Resources.h>
- #include <Packages.h>
-
- #ifdef __MWERKS__
- #include <A4Stuff.h>
- #endif
- #ifdef THINK_C
- #include <SetupA4.h>
- #endif
-
-
- #if __DebugVersion
- extern void Breakpoint (void) = 0xA9FF;
- extern pascal void Panic (unsigned char * Message) = 0xABFF;
- #define PanicIf(condition, message) if (condition) Panic(message)
- #else
- #define BreakPoint()
- #define Panic(param)
- #define PanicIf(param1,param2)
- #endif
-
-
- #define kDriverName "\p.RamDRVR"
- #define kDRVRType 'DRVR'
-
-
- /*
- ** dCtlFlags bits
- */
-
- #define dNeedLock 0x4000
- #define dNeedTime 0x2000
- #define dNeedGoodBye 0x1000
- #define dStatEnable 0x0800
- #define dCtlEnable 0x0400
- #define dWritEnable 0x0200
- #define dReadEnable 0x0100
- #define drvrActive 0x0080
- #define dRAMBased 0x0040
- #define dOpened 0x0020
-
-
- /*
- ** Low byte of trap word for _Read and _Write
- */
-
- #define aRdCmd 2
- #define aWrCmd 3
-
-
- /*
- ** Standard disk driver csCodes
- */
-
- /* Control codes */
- #define killIOCC 1 /* kill I/O */
- #define verifyDiskCC 5 /* verify disk */
- #define formatDiskCC 6 /* format disk */
- #define ejectDiskCC 7 /* eject disk (ejectable media only) */
- #define setTagBufferCC 8 /* set tag buffer (.SONY) */
- #define trackCacheCC 9, /* control track cache (.SONY) */
- #define physicalIconCC 21 /* return physical location icon and where string */
- #define mediaIconCC 22 /* return media icon */
- #define driveInfoCC 23 /* return drive info */
- #define trackDumpCC 18244 /* diagnostic raw track dump (.SONY) */
-
- /* Status codes */
- #define returnFormatList 6 /* return format list (.SONY) */
- #define driveStatusSC 8 /* drive status */
-
-
- /*
- ** Our driver specific csCodes
- */
-
- /* Control codes */
- #define setGlobalsCC 128 /* copy data pointed to by csParam to driver globals */
-
- /* Status codes */
- #define getGlobalsSC 128 /* return pointer to driver globals */
-
-
- /*
- ** Unit table constants
- */
-
- #define kMaxUTEntries 128 /* maximum size of unit table */
- #define kMinUnitNum 48 /* the lowest unit number we can use */
-
-
- /* Driver globals structure */
- struct DrvrGlobals
- {
- Ptr ramDisk;
- long ramSize;
- short driveNumber;
- Str255 volumeName;
- long physicalIcon[kLargeIconSize/4]; /* IMPORTANT: icon and whereString must be */
- Str255 locationStr; /* end-to-end in memory! */
- long mediaIcon[kLargeIconSize/4];
- };
- typedef struct DrvrGlobals DrvrGlobals;
- typedef DrvrGlobals *DrvrGlobalsPtr, **DrvrGlobalsHandle;
-
-
- /* ConfigRec resource structure */
- struct ConfigRec
- {
- short install; /* boolean true/false */
- long size;
- Str255 volumeName;
- };
- typedef struct ConfigRec ConfigRec;
- typedef ConfigRec *ConfigRecPtr, **ConfigRecHandle;
-
-
- /* A DrvQEl with flags */
- struct MyDrvQEl
- {
- long flags;
- QElemPtr qLink;
- short qType;
- short dQDrive;
- short dQRefNum;
- short dQFSID;
- unsigned short dQDrvSz;
- unsigned short dQDrvSz2;
- };
- typedef struct MyDrvQEl MyDrvQEl;
- typedef MyDrvQEl *MyDrvQElPtr;
-
-
- /* FormatListRec as returned Return Format List status call (csCode = 6). */
- struct FormatListRec
- {
- unsigned long volSize; /* disk capacity in SECTORs */
- SignedByte formatFlags; /* flags */
- SignedByte sectorsPerTrack; /* sectors per track side */
- unsigned short tracks; /* number of tracks */
- };
- typedef struct FormatListRec FormatListRec;
- typedef FormatListRec *FormatListRecPtr;
-
-
- #endif /* end of non-rez */
-
-
- /*
- ** Our resource IDs
- */
-
- #define rCDevSignature 0 /* RamDisk's registered signature ('RDsk') resource ID */
- #define rCdev -4064 /* Required cdev resource ID */
-
- #define rStringList -4033
- #define rLocationStr 1 /* The "where" string used in the Get Info dialog */
- #define rDefaultNameStr 2 /* The initial default volume name */
-
- /* icon family resource IDs */
- #define rLoadOKIcon -4064 /* same as cdev icon */
- #define rLoadBadIcon -4033
- #define rPhysicalIcon -4034
- #define rMediaIcon -4035
-
- /* cdev dialog item resource IDs */
- #define rCDevCheckbox -4033
- #define rCDevLogoPICT -4033
- #define rCDevSizeBarPICT -4034
-
- #endif __RAMDISK__
-